package cn.egeek.babel.entity;

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * Comment entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "comment", catalog = "yd_bbs_db")
public class Comment implements java.io.Serializable {

	// Fields

	private Long id;
	private Topic topic;
	private User user;
	private String content;
	private String authorName;
	private String authorEmail;
	private String authorUrl;
	private String authorIp;
	private Date createTime;
	private Date createTimeGmt;
	private String status;
	private Integer sequence;

	// Constructors

	/** default constructor */
	public Comment() {
	}

	/** full constructor */
	public Comment(Topic topic, User user, String content, String authorName,
			String authorEmail, String authorUrl, String authorIp,
			Date createTime, Date createTimeGmt, String status, Integer sequence) {
		this.topic = topic;
		this.user = user;
		this.content = content;
		this.authorName = authorName;
		this.authorEmail = authorEmail;
		this.authorUrl = authorUrl;
		this.authorIp = authorIp;
		this.createTime = createTime;
		this.createTimeGmt = createTimeGmt;
		this.status = status;
		this.sequence = sequence;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "topic_id")
	public Topic getTopic() {
		return this.topic;
	}

	public void setTopic(Topic topic) {
		this.topic = topic;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "author_user_id")
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "content", length = 65535)
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Column(name = "author_name")
	public String getAuthorName() {
		return this.authorName;
	}

	public void setAuthorName(String authorName) {
		this.authorName = authorName;
	}

	@Column(name = "author_email", length = 100)
	public String getAuthorEmail() {
		return this.authorEmail;
	}

	public void setAuthorEmail(String authorEmail) {
		this.authorEmail = authorEmail;
	}

	@Column(name = "author_url", length = 200)
	public String getAuthorUrl() {
		return this.authorUrl;
	}

	public void setAuthorUrl(String authorUrl) {
		this.authorUrl = authorUrl;
	}

	@Column(name = "author_ip", length = 100)
	public String getAuthorIp() {
		return this.authorIp;
	}

	public void setAuthorIp(String authorIp) {
		this.authorIp = authorIp;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "create_time", length = 0)
	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "create_time_gmt", length = 0)
	public Date getCreateTimeGmt() {
		return this.createTimeGmt;
	}

	public void setCreateTimeGmt(Date createTimeGmt) {
		this.createTimeGmt = createTimeGmt;
	}

	@Column(name = "status", length = 20)
	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Column(name = "sequence")
	public Integer getSequence() {
		return this.sequence;
	}

	public void setSequence(Integer sequence) {
		this.sequence = sequence;
	}

}